<template>
	<view class="wrap">
		<pageNav :desc="desc"></pageNav>
		<view class="list-wrap">
			<u-cell-group title-bg-color="rgb(243, 244, 246)" :title="item.groupName" v-for="(item, index) in list" :key="index">
				<u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1.path)" :title="getFieldTitle(item1)" :value="item1.value"
				 v-for="(item1, index1) in item.list" :key="index1">
					<image slot="icon" class="u-cell-icon" :src="getIcon(item1.icon)" mode="widthFix"></image>
				</u-cell-item>
			</u-cell-group>
		</view>
		<u-gap height="70"></u-gap>
		<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
	</view>
</template>

<script>
	import list from "./template.config.js";
	export default {
		data() {
			return {
				list: list,
				desc: '收集众多的常用页面和布局，减少开发者的重复工作，让你专注逻辑，事半功倍.',
			}
		},
		
		onLoad() {
			console.log(this.list)
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			},
		},
		onShow() {
			
		},
		methods:{
			openPage(path) {
				this.$u.route({ 
					url: '/pages/template/' + path + '/index'
				})
			},
			getFieldTitle(item) {
				return item.title
			}
		}
	}
</script>

<style lang="scss">
	.u-cell-icon {
		width: 36rpx;
		height: 36rpx;
		margin-right: 8rpx;
	}
</style>
